<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/bootstrap.min.css"/>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/commom.css"/>
		<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css"/>
	</head>
	<body>
		
		<div class="container-fluid right-iframe-wrapper">
			<div class="row">
				<div class="right-title">
					<h1 class="font-18">社团新闻管理<small class="font-16">&nbsp;&nbsp;-&nbsp;&nbsp;社团新闻管理</small></h1>
				</div>
				<div class="clearfix"></div>
				<div class="row">
					<!--<span class="pull-left">
						<a class="btn btn-warning" href="addStudentTime.html">增加</a>
						<a class="btn btn-danger">删除</a>
						<a class="btn btn-info" href="#">修改</a>
					</span>-->
					<div class="right-search col-md-4 col-xs-6 pull-right no-pd-right">
						
						<div class="input-group">
							<input type="text" class="form-control" placeholder="输入关键字搜索" name="seach" id="a">
							<span class="input-group-btn">
						        <button class="btn btn-warning" type="button" id="seach">搜索</button>
						    </span>
						</div>
					</div>
				</div>
				
				<!--表格-->
				<div class="right-table">
					<table class="table table-bordered table-hover text-center">
						<thead>
							<tr>
								<th>序号</th>
								<th>新闻名称</th>
								<th>所属社团</th>
								<th>发布时间</th>
								<th>内容</th>
								<th>操作</th>
								
							
								<!--<th>阶段奖励</th>
								<th>负激励</th>-->
							</tr>
						</thead>
						<tbody name="cx">
						<c:forEach items="${newslist }" var="list">
							<tr>
								<td>${list.nid }</td>
								<td>${list.title }</td>
								<td>${list.gname }</td>
								<td>${list.date }</td>
								<td>${list.content }</td>
								<td><!-- <a style="cursor: pointer;">编辑</a>| --><a style="cursor: pointer;" href="detelenews.do?nid=${list.nid }">删除</a></td>
								
								
							
								<!--<td>10</td>-->
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
				<!--分页-->
				<!--<div value="1 0"></div>
		<div id="page" class="page_div"></div>-->
				<!--分页 end-->
			</div>
		</div>
		
		<!--<footer class="footer-wrapper text-center">
			<p>&copy;2017 创智盟版权所有 - 电话：0771-1234567</p>
		</footer>-->
		
		<script src="${pageContext.request.contextPath}/js/bootstrap.min.js" type="text/javascript"></script>
		<script src="${pageContext.request.contextPath}/js/jquery-2.1.3.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="../js/paging.js"></script>
	<script>
	
	    /*
		// 模拟ajax数据用以下方法，方便用户更好的掌握用法
		//参数为当前页
		ajaxTest(1);
		
		function ajaxTest(num) {
			$.ajax({
				url: "table.json",
				type: "get",
				data: {},
				dataType: "json",
				success: function(data) {
					console.log(data);
					//分页
					$("#page").paging({
						pageNo: num,
						totalPage: data.totalPage,
						totalSize: data.totalSize,
						callback: function(num) {
							ajaxTest(num)
						}
					})
				}
			})
		}
		*/
	</script>
		<script type="text/javascript">
			$(function(){
				$("#seach").click(function(){
					$.post("seach.do",{seach:$("#a").val()},function(result){
						if(result!=""){
							$("tbody[name='cx']").empty();
							for(var i=0;i<result.length;i++){
								
									$("tbody[name='cx']").append("<tr><td>"+result[i].nid+"</td>"
											+"<td>"+result[i].title+"</td><td>"+result[i].gname+"</td>"
											+"<td>"+result[i].date+"</td><td>"+result[i].content+"</td>"+"<td><a style='cursor: pointer;'>编辑</a>|<a style='cursor: pointer;' href='detelenews.do?nid="+result[i].nid+"'>删除</a></td></tr>");
								}	
							}
						else{
							alert("没有此新闻！")
						}
					})
				})
			})
			
		</script>
	</body>
</html>